package com.douwong.student.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

import com.douwong.student.R;

/**
 * 颜色变化器
 * 
 * @author Administrator
 * 
 */
public class ColorChangeView extends View {

	private Paint mPaint;

	private int color;
    private int size;
	public ColorChangeView(Context context) {
		super(context);
	}

	public ColorChangeView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	
	public ColorChangeView(Context context, AttributeSet attrs) {
		super(context, attrs);
		mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
		color=context.getResources().getColor(R.color.color_11);
		size=5;
		invalidate();
	}

	public void setColor(int color,int size) {
		this.color=color;
		this.size=size;
		invalidate();
	}

	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		mPaint.setColor(color); 
		canvas.drawCircle(getWidth()/2, getHeight()/2, size, mPaint);
	}
}
